<template>
    <view>
      <u-cell v-for="(item, index) in list" :key="item.value" :title="item.label" @click="$emit('target', item, index)">
        <u-icon v-if="active === index" slot="right-icon" size="20" color="#409EFF" name="checkmark"></u-icon>
      </u-cell>
    </view>
</template>

<script>
  import {
    listTypeOptions
  } from '@/apis/bill/goodSpu'
  export default {
    name: 'cx-commodity-type',
    props: {
      active: {
        type: Number,
        default: 0
      }
    },
    data() {
      return {
        list: [
          {value: 0, label: "全部"},
        ]
      }
    },
    mounted() {
      listTypeOptions().then(res => {
        if (!res.data.flag) return
        res.data.data.forEach(item => {
          this.list.push({
            value: item.value + 1,
            label: item.label
          })
        })
      })
    }
  }
</script>

<style scoped lang="scss">

</style>
